//
//  View+Extension.swift
//  swiftUIdemo
//
//  Created by Z.cy on 2025/1/8.
//

import SwiftUI

extension View {
    @ViewBuilder
    func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View {
        if condition {
            transform(self)
        } else {
            self
        }
    }

//    func colorButton(type: ButtonType) -> some View {
//        self.modifier(ColorButton(type: type))
//    }
    
    func endEditing(_ force: Bool) {
        UIApplication.shared.windows.forEach { $0.endEditing(force) }
    }
}
